Get rid of the rest of variables exported from libgtk
authorTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 17:33:30 +0000 (20:33 +0300)
committerTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 18:31:34 +0000 (21:31 +0300)
Especially the gtk_*_type ones in gtktexttypes.h were mentioned in
gtk.symbols presumably by accident. That header isn't even installed,
so no way can they be supposed to be public.

gtk_text_attr_appearance_type is from the installed but "semi-private"
gtktextlayout.h, so drop that one too from gtk.symbols for now.

The use of gtk_text_unknown_char_utf8 is bit of a mess. Code in a few
files knew implicitly that it is three bytes. Define a symbolic name
for the length of it instead. Add an exported function
gtk_text_unknown_char_utf8_gtk_tests_only() that returns a pointer to
it just for the sake of gtk/tests/textbuffer.c. Prefix the variable
with an underscore.

I doubt the usefulness of the test_utf8() in textbuffer.c. If it could
be dropped, gtk_text_unknown_char_utf8_gtk_tests_only() could be
dropped, too.

gtk/gtk.symbols
gtk/gtktextbtree.c
gtk/gtktextchild.c
gtk/gtktextlayout.c
gtk/gtktextlayout.h
gtk/gtktexttypes.c
gtk/gtktexttypes.h
gtk/tests/textbuffer.c

index d761f30d27db535b8ae6ce69a05ba5676c7e8172..5e5b9abdccdbd55e2fef3ed6f93a2a807b50e8da 100644 (file)
@@ -3274,6 +3274,7 @@ gtk_text_buffer_set_text
 
 #if IN_HEADER(__GTK_TEXT_TYPES_H__)
 #if IN_FILE(__GTK_TEXT_TYPES_C__)
+gtk_text_unknown_char_utf8_gtk_tests_only
 gtk_text_byte_begins_utf8_char
 #endif
 #endif
@@ -4540,15 +4541,3 @@ gtk_info_bar_set_message_type
 gtk_info_bar_get_message_type
 #endif
 #endif
-
-#ifdef INCLUDE_VARIABLES
-gtk_text_attr_appearance_type
-gtk_text_char_type
-gtk_text_child_type
-gtk_text_left_mark_type
-gtk_text_pixbuf_type
-gtk_text_right_mark_type
-gtk_text_toggle_off_type
-gtk_text_toggle_on_type
-gtk_text_unknown_char_utf8
-#endif
index 72abfc5d1f08c87c976447dd909d069b7c642d3b..b07a04ec1f495c866d8bac95862c154e40b87dcf 100644 (file)
@@ -2389,8 +2389,8 @@ copy_segment (GString *string,
       if (copy)
         {
           g_string_append_len (string,
-                               gtk_text_unknown_char_utf8,
-                               3);
+                               _gtk_text_unknown_char_utf8,
+                               GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN);
 
         }
     }
index ad23def3471bd3a15eec88c057a1251c3fa3a3eb..dd7d3a49061766733c874e156479ab1716926da0 100644 (file)
@@ -134,9 +134,10 @@ _gtk_pixbuf_segment_new (GdkPixbuf *pixbuf)
 
   seg->next = NULL;
 
-  seg->byte_count = 3; /* We convert to the 0xFFFC "unknown character",
-                        * a 3-byte sequence in UTF-8
-                        */
+  /* We convert to the 0xFFFC "unknown character",
+   * a 3-byte sequence in UTF-8.
+   */
+  seg->byte_count = GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN;
   seg->char_count = 1;
 
   seg->body.pixbuf.pixbuf = pixbuf;
index fba9de57802c3c07d30613930d53e9abf01ed58c..74b3dd3d6bcf2580d23dd6db7821b0f6572393e7 100644 (file)
@@ -2310,7 +2310,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
                                      size_only, FALSE);
                   add_pixbuf_attrs (layout, display, style,
                                     seg, attrs, layout_byte_offset);
-                  memcpy (text + layout_byte_offset, gtk_text_unknown_char_utf8,
+                  memcpy (text + layout_byte_offset, _gtk_text_unknown_char_utf8,
                           seg->byte_count);
                   layout_byte_offset += seg->byte_count;
                   buffer_byte_offset += seg->byte_count;
@@ -2325,7 +2325,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
                                      size_only, FALSE);
                   add_child_attrs (layout, display, style,
                                    seg, attrs, layout_byte_offset);
-                  memcpy (text + layout_byte_offset, gtk_text_unknown_char_utf8,
+                  memcpy (text + layout_byte_offset, _gtk_text_unknown_char_utf8,
                           seg->byte_count);
                   layout_byte_offset += seg->byte_count;
                   buffer_byte_offset += seg->byte_count;
index a2e8aa3a5d4fcedee9edc793c0a6254aa9aaa870..3be12a3be2ff192a17e58738c10801d9200a5449 100644 (file)
@@ -265,7 +265,9 @@ struct _GtkTextLineDisplay
   guint cursor_at_line_end : 1;
 };
 
+#ifdef GTK_COMPILATION
 extern PangoAttrType gtk_text_attr_appearance_type;
+#endif
 
 GType         gtk_text_layout_get_type    (void) G_GNUC_CONST;
 
index df8f6f5dec7f62e6e36529d6aa3388826146ceef..740cb799721244e6cff068c37ff0907d1ee17c3b 100644 (file)
 /* These are used to represent embedded non-character objects
  * if you return a string representation of a text buffer
  */
-const gchar gtk_text_unknown_char_utf8[] = { '\xEF', '\xBF', '\xBC', '\0' };
+const gchar _gtk_text_unknown_char_utf8[] = { '\xEF', '\xBF', '\xBC', '\0' };
+
+/* This is to be used only by libgtk test programs */
+const gchar *
+gtk_text_unknown_char_utf8_gtk_tests_only (void)
+{
+  return _gtk_text_unknown_char_utf8;
+}
 
 static inline gboolean
 inline_byte_begins_utf8_char (const gchar *byte)
index c624aeaf3a8879dd6a00ce1180f796e8c100e8c3..b8f8278c929a74b01f34bc592911b94af5701edf 100644 (file)
@@ -42,16 +42,6 @@ typedef struct _GtkTextMarkBody GtkTextMarkBody;
  * Declarations for variables shared among the text-related files:
  */
 
-#ifdef G_OS_WIN32
-#ifdef GTK_COMPILATION
-#define VARIABLE __declspec(dllexport)
-#else
-#define VARIABLE extern __declspec(dllimport)
-#endif
-#else
-#define VARIABLE extern
-#endif
-
 /* In gtktextbtree.c */
 extern const GtkTextLineSegmentClass gtk_text_char_type;
 extern const GtkTextLineSegmentClass gtk_text_toggle_on_type;
@@ -70,7 +60,9 @@ extern const GtkTextLineSegmentClass gtk_text_child_type;
  */
 
 #define GTK_TEXT_UNKNOWN_CHAR 0xFFFC
-VARIABLE const gchar gtk_text_unknown_char_utf8[];
+#define GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN 3
+const gchar *gtk_text_unknown_char_utf8_gtk_tests_only (void);
+const gchar _gtk_text_unknown_char_utf8[GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN+1];
 
 gboolean gtk_text_byte_begins_utf8_char (const gchar *byte);
 
index d104358943df7d4bb108e0ee186758255df9106f..19986f2ace49e387a037a108616511b5aa50394e 100644 (file)
@@ -1211,8 +1211,9 @@ test_utf8 (void)
   gunichar ch;
 
   /* Check UTF8 unknown char thing */
-  g_assert (g_utf8_strlen (gtk_text_unknown_char_utf8, 3) == 1);
-  ch = g_utf8_get_char (gtk_text_unknown_char_utf8);
+  g_assert (GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN == 3);
+  g_assert (g_utf8_strlen (gtk_text_unknown_char_utf8_gtk_tests_only (), 3) == 1);
+  ch = g_utf8_get_char (gtk_text_unknown_char_utf8_gtk_tests_only ());
   g_assert (ch == GTK_TEXT_UNKNOWN_CHAR);
 }